<template>
  <div class="icon-font-item" @click="handleClick">
    <svg class="icon" aria-hidden="true">
      <use :xlink:href="`#${props.name}`" />
    </svg>
    <span>{{ props.title }}</span>
  </div>
</template>

<script setup>
const props = defineProps({
  name: {
    type: String,
    required: true
  },
  title: {
    type: String,
    default: ''
  },
  link: {
    type: String,
    default: ''
  }
})
const handleClick = () => {
  if (props.link) {
    window.open(props.link, '_blank')
  }
}
</script>

<style scoped lang="scss">
  .icon {
       width: 4em; height: 2em;
       vertical-align: -0.15em;
       fill: currentColor;
       overflow: hidden;
    }
</style>
